package com.ecommerce.dal.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ecommerce.dal.dao.impl.MembershipCardDAO;
import com.ecommerce.dal.entity.MembershipCard;
import com.ecommerce.dal.service.IMembershipCardManagerService;

@Service("membershipCardManagerService")
public class MembershipCardManagerService implements
		IMembershipCardManagerService {
	@Autowired
	MembershipCardDAO membershipCardDAO;

	@Override
	public MembershipCard retrieveMembershipCard(Long membershipCardID) {
		return membershipCardDAO.findByMembershipCardId(membershipCardID);
	}

	@Override
	public void saveMembershipCard(MembershipCard membershipCard) {
		membershipCardDAO.save(membershipCard);

	}

	@Override
	public List<MembershipCard> retrieveAllMembershipCards() {
		return membershipCardDAO.findAllMembershipCards();
	}

	@Override
	public double retrieveMembershipCardPrice(long membershipCardID) {
		return membershipCardDAO.findMembershipCardPrice(membershipCardID);
	}

	@Override
	public void updateMembershipCard(MembershipCard membershipCard) {
		membershipCardDAO.update(membershipCard);

	}

	@Override
	public void deleteMembershipCard(MembershipCard membershipCard) {
		membershipCardDAO.delete(membershipCard);

	}

	@Override
	public boolean checkMembershipCard(long membershipCardID) {
		return membershipCardDAO.checkMembershipCard(membershipCardID);
	}

}
